

    \filetitle{table}{Start new table}{report/table}

	\paragraph{Syntax}

\begin{verbatim}
P.table(Caption,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{P} {[} report {]} - Report object created by the
  \href{report/new}{\texttt{report.new}} function.
\item
  \texttt{Caption} {[} char \textbar{} cellstr {]} - Title or a cell
  array with title and subtitle displayed at the top of the table; see
  Description for splitting the title or subtitle into multiple lines.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}arrayStretch=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{1.15}} {]} - (Inheritable from parent
  objects) Stretch between lines in the table (in pts).
\item
  \texttt{\textquotesingle{}captionTypeface=\textquotesingle{}} {[} cell
  \textbar{}
  \emph{\texttt{\textquotesingle{}\textbackslash{}large\textbackslash{}bfseries\textquotesingle{}}}
  {]} - LaTeX format commands for typesetting the table caption and
  subcaption; you can use Inf for either to indicate the default format.
\item
  \texttt{\textquotesingle{}colFootnote=\textquotesingle{}} {[} cell
  \textbar{} \emph{empty} {]} - Footnotes for individual dates in the
  headings of the columns, or column names in user-defined tables; the
  option must be a cell array with date-footnote pairs.
\item
  \texttt{\textquotesingle{}colHighlight=\textquotesingle{}} {[} numeric
  \textbar{} \emph{empty} {]} - Dates for which the entire corresponding
  columns will be highlighted; because of a bug in the LaTex package
  \texttt{colortbl}, this option cannot be combined with the option
  \texttt{\textquotesingle{}rowHighlight=\textquotesingle{}} in
  \href{report/series}{\texttt{report/series}}.
\item
  \texttt{\textquotesingle{}colStruct=\textquotesingle{}} {[} struct
  \textbar{} \emph{empty} {]} - User-defined structure of the table
  columns; use of this option disables
  \texttt{\textquotesingle{}range=\textquotesingle{}}.
\item
  \texttt{\textquotesingle{}colWidth=\textquotesingle{}} {[} numeric
  \textbar{} \emph{\texttt{NaN}} {]} - (Inheritable from parent objects)
  Width, or a vector of widhts, of the table columns in
  \texttt{em}units; \texttt{NaN} means the width of the column will
  adjust automatically.
\item
  \texttt{\textquotesingle{}headlineJust=\textquotesingle{}} {[}
  \emph{\texttt{\textquotesingle{}c\textquotesingle{}}} \textbar{}
  \texttt{\textquotesingle{}l\textquotesingle{}} \textbar{}
  \texttt{\textquotesingle{}r\textquotesingle{}} {]} - Horizontal
  justification of the headline entries (individual dates or
  user-defined text): centre, left, right.
\item
  \texttt{\textquotesingle{}footnote=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - Footnote at the table title; only shows
  if the title is non-empty.
\item
  \texttt{\textquotesingle{}long=\textquotesingle{}} {[} true \textbar{}
  \emph{\texttt{false}} {]} - (Inheritable from parent objects) If true,
  the table may stretch over more than one page.
\item
  \texttt{\textquotesingle{}longFoot=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - (Inheritable from parent objects) Works
  only with \texttt{\textquotesingle{}long=\textquotesingle{}}=true:
  Footnote that appears at the bottom of the table (if it is longer than
  one page) on each page except the last one.
\item
  \texttt{\textquotesingle{}longFootPosition=\textquotesingle{}} {[}
  \texttt{\textquotesingle{}centre\textquotesingle{}} \textbar{}
  \emph{\texttt{\textquotesingle{}left\textquotesingle{}}} \textbar{}
  \texttt{\textquotesingle{}right\textquotesingle{}} {]} - (Inheritable
  from parent objects) Works only with
  \texttt{\textquotesingle{}long=\textquotesingle{}} \texttt{true}:
  Horizontal alignment of the footnote in long tables.
\item
  \texttt{\textquotesingle{}range=\textquotesingle{}} {[} numeric
  \textbar{} \emph{empty} {]} - (Inheritable from parent objects) Date
  range or vector of dates that will appear as columns of the table.
\item
  \texttt{\textquotesingle{}separator=\textquotesingle{}} {[} char
  \textbar{}
  \emph{\texttt{\textquotesingle{}\textbackslash{}medskip\textbackslash{}par\textquotesingle{}}}
  {]} - (Inheritable from parent objects) \LaTeX~commands that will be
  inserted after the table.
\item
  \texttt{\textquotesingle{}sideways=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - (Inheritable from
  parent objects) Print the table rotated by 90 degrees.
\item
  \texttt{\textquotesingle{}tabcolsep=\textquotesingle{}} {[}
  \texttt{NaN} \textbar{} numeric {]} - (Inheritable from parent
  objects) Space between columns in the table, measured in em units; NaN
  means the \LaTeX~default.
\item
  \texttt{\textquotesingle{}typeface=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - \LaTeX~code specifying the typeface for
  the table as a whole; it must use the declarative forms (such as
  \texttt{\textbackslash{}itshape}) and not the command forms (such as
  \texttt{\textbackslash{}textit\{...\}}).
\item
  \texttt{\textquotesingle{}vline=\textquotesingle{}} {[} numeric
  \textbar{} \emph{empty} {]} - (Inheritable from parent objects) Vector
  of dates after which a vertical line (divider) will be placed.
\end{itemize}

\paragraph{Date format options}

See \href{dates/dat2str}{\texttt{dat2str}} for details on date format
options.

\begin{itemize}
\item
  \texttt{\textquotesingle{}dateFormat=\textquotesingle{}} {[} char
  \textbar{} cellstr \textbar{}
  \emph{\texttt{\textquotesingle{}YYYYFP\textquotesingle{}}} {]} - Date
  format string, or array of format strings (possibly different for each
  date).
\item
  \texttt{\textquotesingle{}freqLetters=\textquotesingle{}} {[} char
  \textbar{} \emph{\texttt{\textquotesingle{}YHQBMW\textquotesingle{}}}
  {]} - Six letters used to represent the six possible frequencies of
  IRIS dates, in this order: yearly, half-yearly, quarterly, bi-monthly,
  monthly, and weekly (such as the
  \texttt{\textquotesingle{}Q\textquotesingle{}} in
  \texttt{\textquotesingle{}2010Q1\textquotesingle{}}).
\item
  \texttt{\textquotesingle{}months=\textquotesingle{}} {[} cellstr
  \textbar{}
  \emph{\texttt{\{\textquotesingle{}January\textquotesingle{},...,\textquotesingle{}December\textquotesingle{}\}}}
  {]} - Twelve strings representing the names of the twelve months.
\item
  \texttt{\textquotesingle{}standinMonth=\textquotesingle{}} {[} numeric
  \textbar{} \texttt{\textquotesingle{}last\textquotesingle{}}
  \textbar{} \emph{\texttt{1}} {]} - Month that will represent a
  lower-than-monthly-frequency date if the month is part of the date
  format string.
\end{itemize}

\paragraph{Generic options}

See help on \href{report/Contents}{generic options} in report objects.

\paragraph{Description}

Tables are top-level report objects and cannot be nested within other
report objects, except \href{report/align}{\texttt{align}}. Table
objects can have the following children:

\begin{itemize}
\tightlist
\item
  \href{report/series}{\texttt{series}};
\item
  \href{report/subheading}{\texttt{subheading}}.
\end{itemize}

By default, the date row is printed as a leading row with dates formated
using the option
\texttt{\textquotesingle{}dateFormat=\textquotesingle{}}. Alternatively,
you can specify this option as a cell array of two strings. In that
case, the dates will be printed in two rows. The first row will have a
date string displayed and centred for every year, and the first cell of
the \texttt{\textquotesingle{}dateFormat=\textquotesingle{}} option will
be used for formatting. The second row will have a date displayed for
every period (i.e.~every column), and the second cell of the
\texttt{\textquotesingle{}dateFormat=\textquotesingle{}} option will be
used for formatting.

\subparagraph{User-defined structure of the table
columns}

Use the option \texttt{\textquotesingle{}colStruct=\textquotesingle{}}
to define your own table columns. This gives you more flexibility than
when using the \texttt{\textquotesingle{}range=\textquotesingle{}}
option in defining the content of the table.

The option \texttt{\textquotesingle{}colStruct=\textquotesingle{}} must
be a 1-by-N struct, where N is the number of columns you want in the
table, with the following fields:

\begin{itemize}
\item
  \texttt{\textquotesingle{}name=\textquotesingle{}} - specifies the
  descriptor of the column that will be displayed in the headline;
\item
  \texttt{\textquotesingle{}func=\textquotesingle{}} - specifies a
  function that will be applied to the input series; if
  \texttt{\textquotesingle{}func=\textquotesingle{}} is empty, no
  function will be applied. The function must evaluate to a tseries or a
  numeric scalar.
\item
  \texttt{\textquotesingle{}date=\textquotesingle{}} - specifies the
  date at which a number will be taken from the series unless the
  function \texttt{\textquotesingle{}func=\textquotesingle{}} applied
  before resulted in a numeric scalar.
\end{itemize}

\subparagraph{Titles and subtitles}

The input argument \texttt{Caption} can be either a text string, or a
1-by-2 cell array of strings. In the latter case, the first cell will be
printed as a title, and the second cell will be printed as a subtitle.

To split the title or subtitle into multiple lines, use the following
LaTeX commands wrapped in curly brackets:
\texttt{\{\textbackslash{}\textbackslash{}\}} or
\texttt{\{\textbackslash{}\textbackslash{}{[}Xpt{]}\}}, where \texttt{X}
is the width of an extra vertical space (in points) added between the
respective lines.

\paragraph{Example}

Compare the headers of these two tables:

\begin{verbatim}
x = report.new();

x.table('First table', ...
    'range',qq(2010,1):qq(2012,4), ...
    'dateformat','YYYYFP');
% You can add series or subheadings here.

x.table('Second table', ...
    'range,qq(2010,1):qq(2012,4), ...
    'dateformat',{'YYYY','FP'});
% You can add series or subheadings here.

x.publish('myreport.pdf');
\end{verbatim}


